import { NavController } from 'ionic-angular/navigation/nav-controller';
import { UrlService } from './../../../../providers/url-service';
import { Component } from '@angular/core';
import { Api } from '../../../../providers/api-service';

/**
 * 余额明细
 */
@Component({
  selector: 'page-wallet-yuemx',
  templateUrl: 'wallet-yuemx.html',
})
export class WalletYuemxPage {
  billList;
  pageIndex=1;
  constructor(
    public urlService: UrlService,
    public navCtrl: NavController,
    public api:Api

  ) {
    this.init();
   }

  doRefresh(event) {
      setTimeout(() => {
        this.init();
        event.complete();
      }, 2000);

  }
  /**
   * 初始化
   */
  init() {
    this.GetUserBillList(this.pageIndex);
    this.getUserInfo();
  }
  /**
   * 余额明细列表
   * @param pageIndex 
   */
  GetUserBillList(pageIndex) {
    this.urlService.GetUserBillList(pageIndex)
    .then(msg=>{
      //console.log(msg);
      if (msg.Code==0){
    
        this.billList = msg.Data.Items;
      }
    })
    .catch(error=>{
        //console.log(error.Msg);
    })


  }

  money;
  /**
   * 获取用户信息
   */
  getUserInfo() {

    this.urlService.getUser(this.api.getUserinfo("UserID"))
      .then(msg => {
        //console.log(msg);
 
        this.money = msg.Data.RMB;
      })
      .catch(error => {

      })
  }


}